#include "messageBox.h"

MessageBox::MessageBox()
{
	//实现按钮和标签
	btn = new QPushButton();
	label = new QLabel("xiaoxi");
	//布局
	QVBoxLayout *lay = new QVBoxLayout();
	lay->addWidget(btn);
	lay->addWidget(label);
	setLayout(lay);
	
	//关联信号和槽函数
	connect(btn, SIGNAL(clicked()), this, SLOT(mySlot()));

}

void MessageBox::mySlot()
{
	switch(QMessageBox::question(this, "hehehehe", "hahahaah",QMessageBox::Ok, QMessageBox::Open, QMessageBox::Save))
	{
		case QMessageBox::Ok:
			label->setNum(10);
			break;
		case QMessageBox::Open:

			label->setNum(50);
			break;
		case QMessageBox::Save:
			label->setNum(100);
			break;
		default:
			break;
	}
}
